<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script type="text/javascript" src="jquery/jquery.min.js" charset="UTF-8"></script>
<script>
    $(function () {
        $("#send").click(function () {
            var $name = $("#username").val();
            var $pwd = $("#password").val();

            var user = {userName: $name, passWord: $pwd};
            var url = "LoginServlet";

            $.post(url, JSON.stringify(user), function (data) {
                console.log(data);
                var json = JSON.parse(data);
                alert(json.message);
            })


        });
    })
</script>


<form>
    用户名：<input type="text" id="username"/><br/>
    密码：<input type="password" id="password"/><br/>
    <input type="button" value="登录" id="send">
</form>
</body>
</html>
